<template>
	<view class="u-skeleton">
		<!-- 顶部导航 -->
		<fa-navbar title="提交订单" :border-bottom="false"></fa-navbar>
		<view class="bg-white u-flex u-row-between u-p-30 u-m-b-20" @click="goPage('/pages/address/address?type=select')">
			<view class="u-skeleton-rect">
				<view class="text-weight">
					<text>{{ vuex_address.receiver || '请选择地址' }}</text>
					<text class="u-m-l-20">{{ vuex_address.mobile || '' }}</text>
				</view>
				<view class="u-tips-color u-p-t-10">{{ vuex_address.address || '' }}</view>
			</view>
			<view class="u-tips-color u-m-l-30"><u-icon name="arrow-right"></u-icon></view>
		</view>
		<view class="order-list u-skeleton-rect">
			<view class="item u-p-30 u-flex" v-for="(item, index) in list" :key="index">
				<image :src="(item.sku && item.sku.image) || item.goods.image" mode="aspectFill"></image>
				<view class="u-flex-1 right">
					<view class="u-line-2">{{ item.goods.title }}</view>
					<view class="u-line-1 title-sku u-font-24 u-tips-color u-m-t-5" v-if="item.sku">{{ item.sku_attr }}</view>
					<view class="u-line-1 title-sku u-font-24 u-tips-color u-m-t-5" v-if="item.sku">以旧换新价格{{ item.sku.price_yjhx }}</view>
													   
				 
					<view class="u-line-1 title-sku u-font-24 u-tips-color u-m-t-5" v-if="item.goods.isys=='normal'">预售商品;原价{{ (item.sku && item.sku.price) || item.goods.price }}</view>
					<view class="u-flex u-row-between u-m-t-5">
						<text class="price u-font-30"  v-if="item.goods.isys !='normal'" >{{ (item.sku && item.sku.price) || item.goods.price }}</text>
						<text class="price u-font-30"  v-if="item.goods.isys=='normal'" >定金{{ (item.sku && item.sku.ysprice) || item.goods.ysprice }}</text>
						
						
						<!-- v-if="info.isys=='normal'">定金 -￥{{ info.ysprice }} -->
						<text class="u-tips-color">×{{ item.nums }}</text>
					</view>
				</view>
			</view>
		</view>
		<view class="notes u-skeleton-rect">
			<u-form ref="uForm" label-width="150">
			<!-- 	<u-form-item label="选择门店">
				 <u-input type="select" input-align="right" :select-open="storeShow" v-model="storename"
				 	placeholder="请选择" @click="storeShow = true"></u-input>
				</u-form-item> -->
				
			<!-- 	<u-form-item label="是否线上下单" prop="isxsxd" label-width="160" :border-bottom="false">
				  <u-input  type="select" input-align="right" :select-open="isxsxdShow" v-model="form.isxsxd" placeholder="请选择" @click="isxsxdShow = true"></u-input>
				</u-form-item> -->
				<!-- <u-form-item label="是否自提" prop="iszt" label-width="160" :border-bottom="false">
				  <u-input  type="select" input-align="right" :select-open="isztShow" v-model="iszt" placeholder="请选择" @click="isztShow = true"></u-input>
				</u-form-item> -->
				
				<u-form-item label="是否购买电池" prop="isbuydc" label-width="160" :border-bottom="false">
				  <u-input  type="select" input-align="right" :select-open="isbuydcShow" v-model="isbuydc" placeholder="请选择" @click="isbuydcShow = true"></u-input>
				</u-form-item>
				
				<u-form-item label="选择电池" v-if="isbuydc=='是' ">
				 <u-input type="select" input-align="right" :select-open="dianchibrandShow" v-model="dianchibrandname"
				 	placeholder="请选择" @click="dianchibrandShow = true"></u-input>					
				</u-form-item>
				<u-form-item label="电池是否以旧换新"  v-if="isbuydc=='是' " prop="isbuydcyjhx" label-width="160" :border-bottom="false">
				  <u-input  type="select" input-align="right" :select-open="isbuydcyjhxShow" v-model="isbuydcyjhx" placeholder="请选择" @click="isbuydcyjhxShow = true"></u-input>
				</u-form-item>
				
			<!-- 	<u-form-item label="电池价格" v-if="isbuydc=='是' ">
				   <u-input type="number" v-model="dcrealprice" maxlength=5   />			
				</u-form-item>
				 -->
				
				<u-form-item label="电池价格"    v-if="isbuydc=='是' ">
					<view class="price">
						<!-- ￥ -->
						<!-- <text v-text="dcrealprice">
							
						</text> -->
						<!-- @blur="dealprice(e)" -->
							<u-input type="number" v-model="dcrealprice" maxlength=5    />
					</view>
				</u-form-item>
				
				
				
				<u-form-item label="提醒">				 
					<span style="color:red"> 如果选择电池,将在支付时候合并支付！</span>
				</u-form-item>
				
				
				
				<u-form-item label="单品是否以旧换新">
					 <u-input type="select" input-align="right" :select-open="isyjhxShow" v-model="isyjhx"
					 	placeholder="请选择" @click="isyjhxShow = true"></u-input>
					</u-form-item>
					<!-- 万一 添加到购物车 合并支付 这个变量没法用，这个是根据后台商品设置得以旧换新价格是多少就多少。只能单规格 以旧换新 250908-->
					<!-- <u-form-item label="单品以旧换新价" prop="goodsrealpricedan" v-if="isyjhx=='是'">
						<u-input type="number" v-model="goodsrealpricedan" maxlength=5    />
					</u-form-item> -->
					
					<!-- 如果以旧换新  计算规格-->
					<u-form-item label="以旧换新价" prop="pricechange" v-if="isyjhx=='是'">
						<u-input type="number" v-model="pricechange" maxlength=5  @blur="dealprice(e)"  />
					</u-form-item>
					
					 
					 
					
				<!-- 	<u-form-item label="单品以旧换新价"   v-if="isyjhx=='是'">
						<view class="price">
							￥
							<text v-text="goodsrealpricedan"></text>
						</view>
					</u-form-item> -->
					
				
				
				<u-form-item label="选择销售员">
				 <u-input type="select" input-align="right" :select-open="salepersonShow" v-model="salepersonname"
				 	placeholder="请选择" @click="salepersonShow = true"></u-input>
				</u-form-item>
				
				
				
				<view class="u-p-30 u-m-t-30 bg-white" >
					<view class="text-weight u-p-b-30">上传图片</view>
					<u-upload
						width="150"
						height="150"
						ref="uUpload"
						@on-uploaded="onUploaded"
						@on-remove="onRemove"
						:action="uploadurl"
						:header="header"
						:form-data="formdata"
						max-count="5"
					 ></u-upload>
				</view>	
					 
				
			    <!-- <u-form-item label="备注"><u-input v-model="memo" /></u-form-item> -->
				
			 
				 
				<!-- 员工替用户下单 st -->				
				<u-form-item label="用户姓名" prop="daigouname"  v-if="flag=='odgoodsaddbyuserxx' || flag=='buypj'">
					<u-input v-model="daigouname" />
				</u-form-item>
				<u-form-item label="用户电话" prop="daigoumobile" v-if="flag=='odgoodsaddbyuserxx'  || flag=='buypj' " >
					<u-input v-model="daigoumobile" />
				</u-form-item>
				<u-form-item label="用户地址" prop="daigouaddress" v-if="flag=='odgoodsaddbyuserxx'  || flag=='buypj' " >
					<u-input v-model="daigouaddress" />
				</u-form-item>
				<!-- 员工下单 ed -->
				
				
				
				<u-form-item label="备注"><u-input v-model="memo" /></u-form-item>
				<u-form-item label="商品金额">
					<view class="price">
						￥
						<text v-text="order_info.goodsprice"></text>
					</view>
				</u-form-item>
				<u-form-item label="运费">
					<view class="price">
						￥
						<text v-text="order_info.shippingfee"></text>
					</view>
				</u-form-item>
				<u-form-item label-width="120" label="优惠券">
					<view class="coupon u-tips-color u-text-right price" @click="showCouponList" v-if="couponList.length">
						{{ coupon.user_coupon_id ? coupon.name + ' (-￥' + order_info.discount + ')' : '请选择优惠券' }}
					</view>
					<view class="coupon u-tips-color u-text-right" v-else>
						暂无可用优惠券
					</view>
				</u-form-item>
				
				
				<u-form-item label="提醒">
					<span style="color:red"> 如果页面涉及多个条件结算！以支付页面金额为准!!!</span>
				</u-form-item>
			</u-form>
		</view>
		<u-gap height="150" bg-color="#fffff"></u-gap>
		<!-- 底部导航条 -->
		<view class="footer-bar u-flex u-row-between">
			<view class="u-tips-color u-flex-1 u-skeleton-rect">
				<text>共</text>
				<text class="u-m-l-5 u-m-r-5">{{ totalNums }}</text>
				<text>件</text>
			</view>
			<view class="u-text-right u-font-30 u-flex-1 u-skeleton-rect">
				<text class="u-m-r-5">合计</text>
				<text class="price">￥{{ order_info.saleamount }}</text>
			</view>
			
			
			<view class="u-m-l-20">
				<u-button size="medium" hover-class="none" type="primary" :custom-style="{ width: '220rpx', backgroundColor: '#FF4500', color: theme.color }" shape="circle" @click="add">
					提交订单
				</u-button>
			</view>
		</view>
		<fa-coupon v-model="show_coupon" :couponList="couponList" :mode="1" :totalPrice="totalPrice" @success="couponSuccess"></fa-coupon>
		<u-skeleton :loading="loading" :animation="true" bgColor="#FFF"></u-skeleton>
		
		
		<u-select v-model="storeShow" :list="storeList" @confirm="storeConfirm"></u-select>
	    <u-select v-model="salepersonShow" :list="salepersonList" @confirm="salepersonConfirm"></u-select>
	
		<!-- 规格拉选择 多列 联动 -->
		<u-select mode="mutil-column-auto" v-model="dianchibrandShow" :list="dianchibrandList" @confirm="dianchibrandConfirm"></u-select>
		
		<u-select v-model="isxsxdShow" :list="isornoList" @confirm="isxsxdConfirm"></u-select>
		
		<u-select v-model="isztShow" :list="isornoList" @confirm="isztConfirm"></u-select>
		<u-select v-model="isyjhxShow" :list="isornoList" @confirm="isyjhxConfirm"></u-select>
		<!-- 电池逻辑 -->
	    <u-select v-model="isbuydcShow" :list="isornoList" @confirm="isbuydcConfirm"></u-select>
	    <u-select v-model="isbuydcyjhxShow" :list="isornoList" @confirm="isbuydcyjhxConfirm"></u-select>
		<!-- 底部导航 -->
		<fa-tabbar></fa-tabbar>
	</view>
</template>

<script>
	export default {	
		computed: {
			addressChange() {
				return this.vuex_address;
			},
			totalNums() {
				return this.list.reduce(function(total, item) {
					return total + parseInt(item.nums);
				}, 0);
			},
			totalPrice() {
				return this.couponTotalPrice;
			},
			saleAmount() {
				if (!this.totalPrice) {
					return 0;
				}
				return (Math.max(0, parseFloat(this.totalPrice) + parseFloat(this.order_info.shippingfee))).toFixed(2);
			},
			header() {
				return {
					token: this.vuex_token || '',
					uid: this.vuex_user.id || 0
				};
			},
			formdata() {
				let multipart = (this.vuex_config.config && this.vuex_config.config.upload.multipart) || '';
				let isObj = this.$u.test.object(multipart);
				if (isObj) {
					return this.vuex_config.config.upload.multipart;
				}
				return {};
			},
			uploadurl() {
				if (!this.vuex_config.upload) {
					return '';
				}
				return this.vuex_config.upload.uploadurl;
			}
		},
		watch: {
			addressChange(val, oldVal) {
				this.reCalculate();
			}
		},
		data() {
			return {
				cart_ids: '',
				list: [],
				order_info: {},
				memo: '',
				daigouname:'',
				daigoumobile:'',
				 daigouaddress:'',
				loading: true,
				show_coupon: false,
				couponList: [],
				couponTotalPrice: 0,
				coupon: {},
				storeShow: false,
				storeList: [],
				salepersonShow: false,
				
				dianchibrandShow: false,
				storeid:'',
				storename:'',
				salepersonList: [],
				salepersonid:'',
				salepersonname:'',
			    dianchibrandShow: false,
				dianchibrandList: [],
				dianchibrandpid:'',
				dianchibrandcid:0,
				dianchibrandname:'',
				dianchibrandSpeclist:[],				
				
				
				
				pricechange:'',
				pricereal:0,
				
				isxsxd:'请选择',
				isxsxdShow: false,
				iszt:'请选择',
				isztShow: false,
				isyjhx:'请选择',
				isyjhxShow: false,
				isbuydc:'请选择',
				isbuydcShow: false,
				isbuydcyjhx:'请选择',
				isbuydcyjhxShow: false,
				
			  
				
				timeSHow: false,
				projectShow: false,
				isdefault: false,
				
				isornoList: [					 
					{
						value: '否',
						label: '否'
					},
					{
						value: '是',
						label: '是'
					}
				],
				flag:'',
				mordersn:'',
				images_pzlen:0,
				images_pz:'',
				oldprice:0,		
				goodspriceyjhxdan:0,// 临时记录
				goodspricesaledan:0,// 临时记录
				goodsrealpricedan:0,// 临时记录
				specprice:0,//全局的 规格 
				dcspecpricesale:0,// dianc电池销售价格
				dcspecpriceyjhx:0,// 电池以旧换新
				dcrealprice:'',// 电池最终价格
			};
		},
		onShow() {
			// this.goodscatelist();
			this.storelist();
			this.salepersonlist();
			this.dianchibrandlist();
			
			// this.goodslist();
		},
		onLoad(e) {
			this.flag = e.flag || e.flag || '';
			this.mordersn = e.mordersn || e.mordersn || '';
			
			if(this.flag=="odgoodsaddbyuserxx"){
				// 员工替用户 下单
				this.iszt="是"
			}
			this.cart_ids = e.id;
			this.getDefAddress();
		},
		methods: {
			goodscatelist() {			 
			    let para={flag:'jiuyuan'}
				this.$api.formgoodscate(para).then(res => {
					// this.$u.toast(res.msg);
					if (res.code) {
			         console.log("sdfdsf",res.data)
						this.typeList = res.data;
					}
				});
			
			
			},
			storelist() {			 
			    let para={flag:'jiuyuan'}
				this.$api.storelist(para).then(res => {
					// this.$u.toast(res.msg);
					if (res.code) {
			         console.log("sdfdsf",res.data)
						this.storeList = res.data;
					}
				});
			
			
			},
			// 查询店员
			salepersonlist() {
			    let para={flag:'jiuyuan'}
				this.$api.salepersonlist(para).then(res => {
					// this.$u.toast(res.msg);
					if (res.code) {
			         console.log("sdfdsf",res.data)
						this.salepersonList = res.data;
					}
				});
			
			
			},
			
			// 查询电池品牌
			dianchibrandlist() {
			    let para={flag:'jiuyuan'}
				this.$api.dianchibrandlist(para).then(res => {
					// this.$u.toast(res.msg);
					if (res.code) {
			         console.log("sdfdsf",res.data)
						this.dianchibrandList = res.data;
					}
				});
			
			
			},
			getDefAddress() {
				this.$api.defAddress().then(res => {
					if (res.code) {
						this.$u.vuex('vuex_address', res.data);
					} else {
						this.$u.vuex('vuex_address', {});
					}
				});
			},
			// 商品 跳转到此 
			reCalculate() {
				this.$api
					.orderCarts({
						ids: this.cart_ids,
						address_id: this.vuex_address.id,
						user_coupon_id: this.coupon.user_coupon_id,
						flag: this.flag,
						mordersn:this.mordersn,
						
						
					})
					.then(res => {
						if (res.code) {
							res.data.goods_list.map(item => {
								item.checked = false;
								item.cart_nums = item.nums;
							});
							this.list = res.data.goods_list;
							this.order_info = res.data.order_info;
							this.oldprice = res.data.order_info.saleamount;// 保留最原始价格。参与计算
							// console.log(this.list)
							
							// 规格要判断 如果以旧换新 只适合单个商品 
							let sku=this.list[0]['sku'];// 预售
						
							if(sku){
							    // this.pricechange = this.list[0]['sku']['price_yjhx'];
										
							}else{
								this.goodspriceyjhxdan=this.list[0]['goods']['price_yjhx'];// 以旧换新 都反写
								this.goodspricesaledan=this.list[0]['goods']['price'];// 预售
							}
							
							 
							this.couponList = res.data.coupons;
							this.couponTotalPrice = res.data.couponTotalPrice;
							this.loading = false;
						}
					});
			},
			showCouponList() {
				if (!this.vuex_address.id) {
					this.$u.toast('请选择地址后再选择优惠券');
					return;
				}
				this.show_coupon = true;
			},
			couponSuccess(e) {
				console.log(e)
				this.coupon = e;
				this.reCalculate();
			},
			
			dealprice(e) {
				// 配件价格
			   
				let pricegoods=this.oldprice;
				// 以旧换新
				let pricechange=this.pricechange;
				// console.log(pricegoods,"change",pricechange);			
				// if((pricegoods&&onlychangekcj)){
				// 	this.$u.toast("只换空车架与新车价格不可同时填写");
				// 	return false;
				// }
				
				
				if(pricechange){
					let dealprice1=0;
					let title="以旧换新价格不能大于新车价";
					// if(pricepj){
						// dealprice1=pricepj;
						// this.form.pricereal=pricepj-pricechange;
						// title="以旧换新价格不能大于配件价格";
					// }else if(onlychangekcj){					
					// 	dealprice1=onlychangekcj;
					// 	this.form.pricereal=dealprice1-pricechange;
					//     title="以旧换新价格不能大于只换空车架价格";
					// }
				   if(pricegoods){					
						dealprice1=pricegoods;
						this.goodsrealpricedan=dealprice1-pricechange;// 兼容之前得从后台获取商品得以旧换新 字段 后台根据这个顶价格
					 
						this.order_info.saleamount=this.goodsrealpricedan;
						 title="以旧换新价格不能大于新车价格";
						  
					}
					
					if(dealprice1*1 < pricechange*1){
						this.$u.toast(title);
					}else{
						// this.form.pricereal=pricegoods-pricechange;
					}
					
				}else{
					// this.$u.toast("请输入正确金额");
				}
				
				console.log(e);
			},
			
			//多规格 直接 取值 goodsinfo.
			add() {
				// visible  配置显示ggoods字段
				let that=this;
				if (!this.vuex_address.id) {
					this.$u.toast('请选择地址');
					return;
				}
				if(that.isbuydc=="是"){
					if(this.dcrealprice==""){
						this.$u.toast('请输入电池价格');
						return;
					}
				}
				
				
				let isys=this.list[0]['goods']['isys'];// 预售
				// let skuid=this.list[0]['sku']['id'];// 预售
				let sku=this.list[0]['sku'];// 预售
				// sku
				let ysprice=0;
				let ygrate=0;
				let skuid=0;
				let price_cb=0;
				if(sku){
					if(isys=='normal'){
				// sku
						 ysprice=this.list[0]['sku']['ysprice'];
						 // ygrate=this.list[0]['goods']['ygrate'];// 		
					}							
					 price_cb=this.list[0]['sku']['price_cb'];				
					 skuid=sku['id'];
					 
				}else{
					 ysprice=this.list[0]['goods']['ysprice'];
					 price_cb=this.list[0]['goods']['price_cb'];
					
				}
				 ygrate=this.list[0]['goods']['ygrate'];
				// console.log(sku,"sdf",ysprice);return false;
			
				// console.log('ys',isys)
				// ygrate 员工比列	
				if(this.specprice){
					// let specprice=this.specprice;
				 //    let pricereal=this.pricereal;
					// console.log("jiage",specprice,"dsfsd",pricereal)
					// this.pricereal=parseFloat(pricereal)+ parseFloat(specprice);
				}
				
				 if(this.isyjhx=="是"){
					 // 之前以旧换新价格是 增加 减少？
										  		 // this.goodsrealpricedan=this.goodspriceyjhxdan;
							if(this.goodsrealpricedan==0){
								this.$u.toast('请填写以旧换新价格');
								return;
							}					 
												 
			      }else{
										  	 // this.goodsrealpricedan=0;// 先预设0 
				   }
				
				if(this.daigoumobile || this.daigouname){						
					if(this.daigouaddress==""){
						this.$u.toast('请填写用户代购地址');
						return;
					}
				}
				
				this.$api
					.orderAdd({
						ids: this.cart_ids,
						memo: this.memo,
						address_id: this.vuex_address.id,
						user_coupon_id: this.coupon.user_coupon_id || '',
						storeid:this.storeid,
						pricereal:this.pricereal,
						pricechange:this.pricechange,
						salepersonid:this.salepersonid,
						ygrate:ygrate,
						isys:isys,
						ysprice:ysprice,
						// isxsxd:this.isxsxd,
						iszt:this.iszt,						
						daigoumobile:this.daigoumobile,
						daigouname:this.daigouname,						
						daigouaddress:this.daigouaddress,
						flag:this.flag,
						mordersn:this.mordersn,
						images_pz:this.images_pz,
						skuid:skuid,
						dianchibrandpid:this.dianchibrandpid,
						dianchibrandcid:this.dianchibrandcid,
						
						isbuydc:this.isbuydc,// 是否购买电池
						dcrealprice:this.dcrealprice,
												
					    isyjhx:this.isyjhx,// 针对单品以旧换新单规格 多规格无效
						goodsrealpricedan:this.goodsrealpricedan,	
						specprice:this.specprice,// 电池规格
					})
					.then(res => {
						console.log(res.code);
						if (res.code) {
							// 自提无需支付 金额是0  预售也无需支付
							if (res.data.paystate || this.iszt=="是"  || isys =="normal") {
								
								
								uni.showToast({
								            title: "成功,即将跳转",
								            duration:2000,
								            icon: "none",
								         });
								
								
								setTimeout(function() {
										 
												that.goPage('/pages/order/detail?order_sn=' + res.data.order_sn);
													 // this.shipped_wxhuidiaof2(index1);
								}, 2000);  
								
								
								
							} else {
								this.goPage('/pages/order/payment?index=3&order_sn=' + res.data.order_sn);
							}
						} else {
							this.$u.toast(res.msg);
						}
					});
			},
			
			storeConfirm(e) {
				this.storename = e[0]['label'];
				this.storeid = e[0]['value'];			
			
			    let para={cate:e[0]['value']}
				// this.$api.formgoods(para).then(res => {
					// this.$u.toast(res.msg);
				// 	if (res.code) {
				// 		this.projectList = res.data;
				// 	}
				// });
			},
			
			salepersonConfirm(e) {
				this.salepersonname = e[0]['label'];
				this.salepersonid = e[0]['value'];					
			    let para={cate:e[0]['value']}	 			
			},
			//电池规格  下拉选择
			dianchibrandConfirm(e) {
				let that=this;
				let index = e[0]['index'];
				
				that.dianchibrandname = e[0]['label'];
				that.dianchibrandpid = e[0]['value'];	
				that.dianchibrandcid = e[1]['value'];							
			    that.dianchibrandname= e[0]['label']+"-("+ e[1]['label']+")-"+ e[1]['extra']+"元" 		
				// this.dianchibrandSpeclist = e[0]['child'];		
				
				let dcspecpricearr=e[1]['extra'];
				// 拆分价格
				let specpricev1=dcspecpricearr.split('_');
				// 放到前端判断 最终价格。后端也需要
				if(specpricev1[0]){
					// 售价
						that.dcspecpricesale=specpricev1[0];
				}else{
					that.dcspecpricesale=0;
				}
				// 以旧换新  最终价格 dcrealprice
				if(specpricev1[1]){
					that.dcspecpriceyjhx=specpricev1[1];
				}else{
					that.dcspecpriceyjhx=0;
				}
			 
				console.log(specpricev1);
				
				
				 // let dianchibrandListf1=that.dianchibrandList;
				 // let specpricesale=0;
				 // let specpriceyjhx=0;
				 // 循环渠道
				 // dianchibrandListf1.forEach(function(e1){			 			  
				              
				    // console.log("sfsd",e1)
				// });
				
				
				//   this.specpricesale=e2.extra;
								   // this.specpriceyjhx=e2.price_yjhx;
				
				// console.log("sfsd",this.specpricesale,"ces2",this.specpriceyjhx);
				// console.log("sfsd",e)
			
			    let para={cate:e[0]['value']}
				// this.$api.formgoods(para).then(res => {
					// this.$u.toast(res.msg);
				// 	if (res.code) {
				// 		this.projectList = res.data;
				// 	}
				// });
			
			
				console.log(e)
			},
			
			isxsxdConfirm(e){
									  				// this.form.isneedkc=e[0]['label'];  
									  				this.isxsxd=e[0]['value'];  
									  			
			  },
			  // 自提111
			  isztConfirm(e){
			  						  				// this.form.iszt=e[0]['label'];  
			  		 	this.iszt=e[0]['value'];  
			  						  			
			    },
				
				//是否以旧换新 价格就按照 后台设定的来
				// 判断要注意 不如价格有问题 那种购物车里的 合并支付
				isyjhxConfirm(e){
						  this.isyjhx=e[0]['value'];  
						  if(this.isyjhx=="是"){
							  // 原来价格是根据后台商品设置 。这边字段要沿用之前不然报错251015
						  		 // this.goodsrealpricedan=this.goodspriceyjhxdan;
								 
						  }else{
						  	 this.goodsrealpricedan=0;// 先预设0 
						  }
						  
										  			
				  },
			//是否购买电池
			isbuydcConfirm(e){
					  this.isbuydc=e[0]['value']; 
					  if(this.isbuydc=="是"){
					  					 
					  }else{
						  // 清空
					  	 this.dcrealprice=0;
					  }
									  			
			  },	
			  
			  //是否购买电池
			  isbuydcyjhxConfirm(e){
			  						  				// this.form.iszt=e[0]['label'];  
			  		 this.isbuydcyjhx=e[0]['value'];  
					 
					
					 if(this.isbuydcyjhx=="是"){
						this.dcrealprice=this.dcspecpriceyjhx;
					 }else{
						 this.dcrealprice=this.dcspecpricesale;
					 }
					 
			  						  			
			    },	
				
				
				
				onUploaded(e, name) {
					console.log(e, name);
					console.log("len",e.length);
					if(e.length>5){
						this.$u.toast("最多可以上传5张");
						  // 当文件数量达到限制时，阻止继续添加文件
						      e.stopPropagation();
						return false;
					}
					let images1=""
					images1 = e
						.map(item => {
							return item.response.data.url;
						})
						.join(',');
					// this.form.images=images1;
					this.images_pz=images1;
					
					// let j = JSON.parse(r2.data);
					 this.images_pzlen = e.length;
				},
				onRemove(index, lists, name) {
					this.images_pz = lists
						.map(item => {
							return item.response.data.url;
						})
						.join(',');
				},
				
			
			
			
		}
	};
</script>

<style lang="scss">
	page {
		background-color: #f4f6f8;
	}
</style>
<style lang="scss" scoped>
	.order-list {
		background-color: #ffffff;

		.item {
			border-bottom: 1px solid #f4f6f8;

			image {
				width: 200rpx;
				height: 150rpx;
				border-radius: 5rpx;
			}

			.right {
				padding-left: 20rpx;
				height: 150rpx;
				display: flex;
				flex-direction: column;
				justify-content: space-between;

				.title-sku {
					width: 450rpx;
				}
			}
		}
	}

	.notes {
		margin-top: 30rpx;
		padding: 0 30rpx;
		background-color: #ffffff;

		.price {
			width: 100%;
			text-align: right;
		}

		.coupon {
			width: 100%;
		}
	}
</style>